import React, { SetStateAction, Dispatch, useState} from 'react'
import { itemCount } from './helpers/cart'

export const TotalContext = React.createContext<[number, Dispatch<SetStateAction<number>>]>([0,()=>null])
export interface Props {
  children: React.ReactNode
}
const AnotherStore = ({children}:Props) => {
  const [count, setCount]= useState(itemCount())
  return (
    <TotalContext.Provider value={[count, setCount]}>
      {children}
    </TotalContext.Provider>
  )
}
export default AnotherStore